
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Environment Setup · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-back-to-top-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-flexible-alerts/style.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-page-toc-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-auto-scroll-table/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchors/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-theme-comscore/test.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../styles/website.css">
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="about-this-repository.html" />
    
    
    <link rel="prev" href="appendix.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Computer Network Lab Manual
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../content/ch01/lab-1.html">
            
                <a href="../content/ch01/lab-1.html">
            
                    
                    Lab 1: Switchyard & Mininet
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../content/ch01/prerequisites.html">
            
                <a href="../content/ch01/prerequisites.html">
            
                    
                    Task 1: Prerequisites
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1.1" data-path="../content/ch01/linux.html">
            
                <a href="../content/ch01/linux.html">
            
                    
                    Linux
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.2" data-path="../content/ch01/python.html">
            
                <a href="../content/ch01/python.html">
            
                    
                    Python
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.3" data-path="../content/ch01/git.html">
            
                <a href="../content/ch01/git.html">
            
                    
                    Git
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../content/ch01/workflow.html">
            
                <a href="../content/ch01/workflow.html">
            
                    
                    Task 2: Workflow
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.2.1" data-path="../content/ch01/vscode.html">
            
                <a href="../content/ch01/vscode.html">
            
                    
                    VS Code
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.2" data-path="../content/ch01/mininet.html">
            
                <a href="../content/ch01/mininet.html">
            
                    
                    Mininet
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.3" data-path="../content/ch01/wireshark.html">
            
                <a href="../content/ch01/wireshark.html">
            
                    
                    Wireshark
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.4" data-path="../content/ch01/switchyard.html">
            
                <a href="../content/ch01/switchyard.html">
            
                    
                    Switchyard
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../content/ch01/nju-gitlab.html">
            
                <a href="../content/ch01/nju-gitlab.html">
            
                    
                    Task 3: NJU GitLab
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../content/ch01/modification.html">
            
                <a href="../content/ch01/modification.html">
            
                    
                    Task 4: Modification
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../content/ch02/lab-2.html">
            
                <a href="../content/ch02/lab-2.html">
            
                    
                    Lab 2: Learning Switch
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../content/ch02/preparation.html">
            
                <a href="../content/ch02/preparation.html">
            
                    
                    Task 1: Preparation
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../content/ch02/basic-switch.html">
            
                <a href="../content/ch02/basic-switch.html">
            
                    
                    Task 2: Basic Switch
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../content/ch02/timeouts.html">
            
                <a href="../content/ch02/timeouts.html">
            
                    
                    Task 3: Timeouts
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../content/ch02/lru.html">
            
                <a href="../content/ch02/lru.html">
            
                    
                    Task 4: Least Recently Used
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../content/ch02/ltv.html">
            
                <a href="../content/ch02/ltv.html">
            
                    
                    Task 5: Least Traffic Volume
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="../content/ch02/faq.html">
            
                <a href="../content/ch02/faq.html">
            
                    
                    FAQ
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../content/ch03/ipv4-router.html">
            
                <a href="../content/ch03/ipv4-router.html">
            
                    
                    Lab 3-5: IPv4 Router
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../content/ch03/subch01/lab-3.html">
            
                <a href="../content/ch03/subch01/lab-3.html">
            
                    
                    Lab 3: Respond to ARP
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1.1" data-path="../content/ch03/subch01/preparation.html">
            
                <a href="../content/ch03/subch01/preparation.html">
            
                    
                    Task 1: Preparation
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.1.2" data-path="../content/ch03/subch01/handle-arp-request.html">
            
                <a href="../content/ch03/subch01/handle-arp-request.html">
            
                    
                    Task 2: Handle ARP Request
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.1.3" data-path="../content/ch03/subch01/arp-table.html">
            
                <a href="../content/ch03/subch01/arp-table.html">
            
                    
                    Task 3: Cached ARP Table
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../content/ch03/faq.html">
            
                <a href="../content/ch03/faq.html">
            
                    
                    FAQ
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="appendix.html">
            
                <a href="appendix.html">
            
                    
                    Appendix
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="1.5.1" data-path="environment-setup.html">
            
                <a href="environment-setup.html">
            
                    
                    Environment Setup
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="about-this-repository.html">
            
                <a href="about-this-repository.html">
            
                    
                    About This Repository
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >Environment Setup</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="environment-setup"><a name="environment-setup" class="plugin-anchor" href="#environment-setup"><i class="fa fa-link" aria-hidden="true"></i></a>Environment Setup</h1>
<p>If you see here then you must be a high-end player, the instructions here will be very simple.</p>
<h2 id="install-switchyard"><a name="install-switchyard" class="plugin-anchor" href="#install-switchyard"><i class="fa fa-link" aria-hidden="true"></i></a>Install Switchyard</h2>
<p>You can find instructions <a href="https://shellqiqi.gitee.io/switchyard" target="_blank">here</a>, the repository of switchyard on GitHub. A quick note here for Ubuntu.</p>
<pre><code>git clone https://gitee.com/shellqiqi/switchyard.git
sudo apt-get install libffi-dev libpcap-dev python3-dev python3-pip
</code></pre><p>You can install Switchyard and the necessary related packages in an isolated Python virtual environment (&quot;venv&quot;), which is the recommended path, or in the system directories, which is often less desirable. The venv route is highly suggested, since it makes all installation &quot;local&quot; and can easily destroyed, cleaned up, and recreated.</p>
<p>To create a new virtual environment, you could do something like the following under your workspace folder</p>
<pre><code>python3 -m venv syenv
</code></pre><p>You can change the name <code>syenv</code> to whatever you&apos;d like to name your virtual environment. Next, you need to activate the environment. The instructions vary depending on the shell you&apos;re using. On <code>bash</code>, the command is</p>
<pre><code>source ./syenv/bin/activate
</code></pre><p>You&apos;ll need to replace <code>syenv</code> with whatever you named the virtual environment. If you&apos;re using a different shell than bash, refer to Python documentation on the venv module.</p>
<p>Finally, install Switchyard. All the required additional libraries should be automatically installed, too.</p>
<pre><code>python3 -m pip install switchyard
</code></pre><p>Then I suggest to exclude your virtual environment out of git tracking. Add this line in <code>.gitignore</code></p>
<pre><code>syenv/
</code></pre><h2 id="install-mininet"><a name="install-mininet" class="plugin-anchor" href="#install-mininet"><i class="fa fa-link" aria-hidden="true"></i></a>Install Mininet</h2>
<pre><code>sudo apt-get install mininet
</code></pre><p>Or you want to build mininet yourself. The installation guide is <a href="http://mininet.org/download/" target="_blank">here</a>.</p>
<h2 id="install-wireshark"><a name="install-wireshark" class="plugin-anchor" href="#install-wireshark"><i class="fa fa-link" aria-hidden="true"></i></a>Install Wireshark</h2>
<pre><code>sudo add-apt-repository ppa:wireshark-dev/stable
sudo apt-get update
sudo apt-get install wireshark
</code></pre><p>You need to configure wireshark during installation. For non-superusers capturing packets, choose <em>Yes</em> here.</p>
<p><img src="assets/configure-wireshark.png" alt="configure-wireshark"></p>
<p>Then add your user to <code>wireshark</code> user group to allow you capturing packets.</p>
<pre><code>sudo usermod -a -G wireshark $USER
</code></pre><h2 id="other-softwares"><a name="other-softwares" class="plugin-anchor" href="#other-softwares"><i class="fa fa-link" aria-hidden="true"></i></a>Other Softwares</h2>
<p>You also want to install some editors like Vim, Emacs, Visual Studio Code, Sublime and so on. But we do not install any one of them to avoiding a quarrel about the best editor. Choose your favorite one and install it yourself.</p>
<p>Another helpful module VBoxGuestAdditions is not installed because various virtual machine hypervisors you will use.</p>

<script>console.log("plugin-popup....");document.onclick = function(e){ e.target.tagName === "IMG" && window.open(e.target.src,e.target.src)}</script><style>img{cursor:pointer}</style>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="appendix.html" class="navigation navigation-prev " aria-label="Previous page: Appendix">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="about-this-repository.html" class="navigation navigation-next " aria-label="Next page: About This Repository">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Environment Setup","level":"1.5.1","depth":2,"next":{"title":"About This Repository","level":"1.5.2","depth":2,"path":"appendix/about-this-repository.md","ref":"appendix/about-this-repository.md","articles":[]},"previous":{"title":"Appendix","level":"1.5","depth":1,"path":"appendix/appendix.md","ref":"appendix/appendix.md","articles":[{"title":"Environment Setup","level":"1.5.1","depth":2,"path":"appendix/environment-setup.md","ref":"appendix/environment-setup.md","articles":[]},{"title":"About This Repository","level":"1.5.2","depth":2,"path":"appendix/about-this-repository.md","ref":"appendix/about-this-repository.md","articles":[]}]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["theme-comscore","back-to-top-button","-lunr","-search","search-pro","github","splitter","flexible-alerts","page-toc-button","auto-scroll-table","popup","anchors"],"pluginsConfig":{"styles":{"website":"styles/website.css"},"github":{"url":"https://github.com/shellqiqi/nju-network-experiments"},"splitter":{},"search-pro":{},"auto-scroll-table":{},"popup":{},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"theme-comscore":{},"page-toc-button":{},"back-to-top-button":{},"flexible-alerts":{"danger":{"className":"danger","icon":"fa fa-ban","label":"Attention"},"note":{"className":"info","icon":"fa fa-info-circle","label":"Note"},"style":"callout","tip":{"className":"tip","icon":"fa fa-lightbulb-o","label":"Tip"},"warning":{"className":"warning","icon":"fa fa-exclamation-triangle","label":"Warning"}},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchors":{}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"appendix/environment-setup.md","mtime":"2020-03-21T16:37:37.004Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-03-24T13:21:20.286Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-back-to-top-button/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-flexible-alerts/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-page-toc-button/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-auto-scroll-table/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-theme-comscore/test.js"></script>
        
    

    </body>
</html>

